mui.init({
		swipeBack:false //右滑关闭功能
});
if(window.plus){
    plusReady();
}else{
    document.addEventListener('plusready',plusReady,false);
}
//全局系统编号
var pubxtbh = "";
//全局审批单号
var pubgnid ="";
//全局功能编号
var pubgnbh ="";
function plusReady(){
	var current=plus.webview.currentWebview();
	pubxtbh = current.xtbh;
	pubgnid = current.gnid;
	pubgnbh = current.gnbh;
	loadDetailData(pubxtbh,pubgnid);
	//返回首页
	document.getElementById('home').addEventListener('tap', function() {
	var h=plus.webview.getWebviewById('mainpage');
	plus.webview.show(h);
	mui.fire(h,'tabClick',{tabId:'defaultTab'});
	});
}
//加载自身页面信息
function loadDetailData(xtbh,gnid){
	var token = plus.storage.getItem("token");
	var action = 'mainAction';
	var func ='getNkDetail';
	if(token==null||token==""){
		return;
	}else{
	   panUtil.ajaxLoding.start();
	   mui.ajax(baseServerAdrr+'/mobile/getDbDetail',{
	   data: {
	   		token:token,
	   		xtbh:xtbh,
	   		gnid:gnid,
	   		action:action,
	   		func:func
	   },
	   dataType:'json',//服务器返回json格式数据
	   type:'post',//HTTP请求类型
	   timeout:30000,//超时时间设置为10秒；
	   success:function(data){
		   panUtil.ajaxLoding.stop();
		   if(data.code=='success'){
		   	  //第一级别
              var sys = data.message;
              var table = document.body.querySelector('.pan_table_ul');
              for(var i=0;i<sys.length;i++){
              	 //获取二级数据，这里获取的是list
              	 var sy=sys[i];
              	 var sylist = sy.lists;
              	 for(var j=0;j<sylist.length;j++){
              	 	var arrlist = sylist[j];
              	 	//console.log("sss"+arrlist.F_NKSPDH);
              	 	//document.getElementById("F_NKSPDH").innerHTML = arrlist.F_NKSPDH;
              	 	document.getElementById("F_YWLX").innerHTML = arrlist.F_YWLX;
              	 	//document.getElementById("F_SQDWLB").innerHTML = arrlist.F_SQDWLB;
              	 	document.getElementById("F_SQDWMC").innerHTML = arrlist.F_SQDWMC;
              	 	//document.getElementById("F_NY").innerHTML = arrlist.F_NY;
              	 	//document.getElementById("F_ZDRQ").innerHTML = arrlist.F_ZDRQ;
              	 	document.getElementById("F_PHXMMC").innerHTML = arrlist.F_PHXMMC;
              	 	document.getElementById("F_SKDWMC").innerHTML = arrlist.F_SKDWMC;
              	 	document.getElementById("F_HJJE").innerHTML = arrlist.F_HJJE;
              	 	document.getElementById("F_ZJLX").innerHTML = arrlist.F_ZJLX;
              	 	document.getElementById("F_ZY").innerHTML = arrlist.F_ZY;
              	 	document.getElementById("F_THYY").innerHTML = arrlist.F_THYY;
              	 	var zfyy = "";
              	 	if(arrlist.F_ZFYY=='null'||arrlist.F_ZFYY==""){
              	 		zfyy = "";
              	 	}else{
              	 		zfyy = arrlist.F_ZFYY;
              	 	}
              	 	document.getElementById("F_ZFYY").innerHTML = zfyy;
              	 	var detail = arrlist.detail;
              	 	table.innerHTML='';
              	 	for(var m=0;i<detail.length;m++){
              	 		var arrdetail = detail[m];
              	 		var li = document.createElement('li');
                 		li.className ='mui-table-view-cell';
              	 		//li.innerHTML ='<div class="mui-table"><div class="mui-table-cell mui-col-xs-10"><h5 class="mui-ellipsis pan_icontroldetail_h5">项目名称：'+arrdetail.F_XMMC+'</h5><h5><span class="pan_span_font_title">行项目：</span><span class="pan_span_font_content" >'+arrdetail.F_BUZEI+'</span></h5><h5><span class="pan_span_font_title">付款金额：</span><span class="pan_span_font_content" id="">'+arrdetail.F_YSJE+'</span><span class="pan_span_font_title">预计利息：</span><span class="pan_span_font_content" id="">'+arrdetail.F_ZJLX+'</span></h5><p class="mui-h5" style="word-break: break-word;"><span class="pan_span_font_title">文本：</span><span class="pan_span_font_content">'+arrdetail.F_SGTXT+'</span></p></div></div>';
              	 		if(arrlist.F_YWLX=="历史挂账"){
              	 			li.innerHTML ='<div class="mui-table"><div class="mui-table-cell mui-col-xs-10"><h5 class="mui-ellipsis pan_icontroldetail_h5">项目名称：'+arrdetail.F_XMMC+'</h5><h5><span class="pan_span_font_title">行项目：</span><span class="pan_span_font_content" >'+arrdetail.F_BUZEI+'</span></h5><h5><span class="pan_span_font_title">付款金额：</span><span class="pan_span_font_content" id="">'+arrdetail.F_YSJE+'</span><span class="pan_span_font_title">预计利息：</span><span class="pan_span_font_content" id="">'+arrdetail.F_ZJLX+'</span></h5><p class="mui-h5" style="word-break: break-word;"><span class="pan_span_font_title">基准日期：</span><span class="pan_span_font_content">'+arrdetail.F_ZFBDT+'</span></p></div></div>';
              	 		}else{
              	 			li.innerHTML ='<div class="mui-table"><div class="mui-table-cell mui-col-xs-10"><h5 class="mui-ellipsis pan_icontroldetail_h5">项目名称：'+arrdetail.F_XMMC+'</h5><h5><span class="pan_span_font_title">行项目：</span><span class="pan_span_font_content" >'+arrdetail.F_BUZEI+'</span></h5><h5><span class="pan_span_font_title">付款金额：</span><span class="pan_span_font_content" id="">'+arrdetail.F_YSJE+'</span><span class="pan_span_font_title">预计利息：</span><span class="pan_span_font_content" id="">'+arrdetail.F_ZJLX+'</span></h5></div></div>';
              	 		}
              	 		table.appendChild(li);
              	 	}
              	 }
              }
		   }else{
		   	    mui.toast(data.message);
		   	    setTimeout(function(){
		   	    	panUtil.ReLogin();
		   	    },1000);
		   }
	    },
	    error:function(xhr,type,errorThrown){
		   //异常处理；
		   panUtil.ajaxLoding.stop();
		   mui.toast('服务器异常登录失败! iControlHasDoDetail.js');
	    }
		});
	}
}
//撤销审核
function revoke(){

	var param = pubgnbh+":"+pubgnid;
	var token = plus.storage.getItem("token");
	if(token==null||token==""){
		return;
	}else{
		mui.ajax(baseServerAdrr+'/mobile/getNkspCancel',{
	    data: {
	   		token:token,
	   		params:param
	   },
	   dataType:'json',//服务器返回json格式数据
	   type:'post',//HTTP请求类型
	   timeout:30000,//超时时间设置为10秒；
	   success:function(data){
	   	   if(data.code =="success"){
		   	   mui.toast(data.message);
		   	   plus.webview.close();
	   	   	   var h=plus.webview.getWebviewById("iControlList");
			   plus.webview.show(h);
		       mui.fire(h,"loadListDataHasDo");
	   	   }else{
	   	   	mui.toast(data.message);
	   	   	setTimeout(function(){
		   	    	panUtil.ReLogin();
		   	    },1000);
	   	   }
	    },
	    error:function(xhr,type,errorThrown){
		   //异常处理；
		   mui.toast('服务器异常登录失败! iControlHasDoDetail.js');
	    }
		});
	}
}
//重写返回事件
var old_back = mui.back;
mui.back = function(){
   var h=plus.webview.getWebviewById("iControlList");
   mui.fire(h,"loadListDataHasDo");
   //继续当前页面原有返回逻辑
   old_back();
}
